<?php
	include 'db.php';
	include 'adminControls.php';
	session_start();
	if(!isset($_SESSION['user'])){
		header("location:led-admin.php");
	}
?>

<!DOCTYPE HTML>
<html>
    <head>
    <meta charset=utf-8>
    <title>LEDLAMPS</title>
    <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
    <script src="js/modernizr-1.7.min.js"></script><!-- this is the javascript allowing html5 to run in older browsers -->
    
    <link rel="stylesheet" type="text/css" href="css/reset.css" media="screen" title="html5doctor.com Reset Stylesheet" />
    
    <link rel="stylesheet" href="css/default.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css" media="screen" />
    
    <!-- in the CSS3 stylesheet you will find examples of some great new features CSS has to offer -->
    <link rel="stylesheet" type="text/css" href="css/css3.css" media="screen" />
    
    <!-- general stylesheet contains some default styles, you do not need this, but it helps you keep a uniform style -->
    <link rel="stylesheet" type="text/css" href="css/general.css" media="screen" />
    
    <!-- grid's will help you keep your website appealing to your users, view 52framework.com website for documentation -->
    <link rel="stylesheet" type="text/css" href="css/grid.css" media="screen" />
    </head>
<body>
	
	<div class="header-bg">
        <header>
            <div class="logo col_7 col">
                <h1 id="logo" class="left"><a href="index.html">LEDLAMPS</a></h1>            
            </div>
            
            <div class="head-right-portion right">Hello <?php echo $_SESSION['user']; ?>! <a href="admin-logout.php">logout.</a></div>
            <!-- nav col_9 --> 
        </header>
    </div>
	 
	<section class="row">
    <!-- start add-item-grp -->
    <?php if(isset($_GET['stat'])){
		$stat = $_GET['stat'];
		if($stat == 'upsuccess'){
			echo '<div class="alert alert-success"><a class="close" data-dismiss="alert">×</a> <strong>Item Update Success! </strong>You have successfully updated an item.</div>  ';
		}else if($stat == 'addsuccess'){
			echo '<div class="alert alert-success"><a class="close" data-dismiss="alert">×</a> <strong>Item Add Success! </strong>You have successfully added an item.</div>  ';
		}
	}
	?>
   
   
    	<div id="add-item-grp" class="col_4 left">
        <form action="admin.php" method="post">
          <fieldset>
            <legend>Add Item</legend>
            
             <label>MAG Description</label>
            <input type="text" name="magDesc" id="magDesc"  placeholder="MAG Description">
            
             <label>PH Code</label>
            <input type="text" name="phCode" id="phCode"  placeholder="Ph Code">
           
            <label>Item Name</label>
            <input type="text" name="itemName" id="itemName"  placeholder="name of item">
            <span class="help-block">Type in the name of the item you want to add.</span>
            
            <label>Item Description</label>
            <input type="text" name="itemDesc" id="itemDesc"  placeholder="description of item">
            <span class="help-block">Type in the description of the item you want to add.</span>
            
            <label>Item Price</label>
            <input type="text" name="itemPrice" id="itemPrice"  placeholder="Price of item">
            <span class="help-block">Type in the Price of the item.</span>
            <!--
            <label>Item Group</label>
            <select name="itemGrp" id="itemGrp">
              <option value="1">1</option>
              <option value="2">2</option>
              <option value="3">3</option>
              <option value="4">4</option>
              <option value="5">5</option>
            </select>
            -->
            <span class="help-block">Select the group which this product belongs.</span>
            
             <label>Wattage</label>
            <input type="text" name="watts" id="watts"  placeholder="Wattage">
            
            <label>Comparable Halogen Wattage</label>
            <input type="text" name="chw" id="chw"  placeholder="Comparable Halogen Wattage">
            
              <label>Socket</label>
            <input type="text" name="socket" id="socket"  placeholder="Socket">
            
             <label>Bulb Shape</label>
            <input type="text" name="bshape" id="bshape"  placeholder="Bulb Shape here">
            
            <label>Beam Intensity</label>
            <input type="text" name="binsten" id="binsten"  placeholder="Beam Intensity">
            
           <label>Beam Angle</label>
            <input type="text" name="bangle" id="bangle"  placeholder="Beam Angle">
            
            <label>LifeTime</label>
            <input type="text" name="lifetime" id="lifetime"  placeholder="Lifetime">
                        
            <label>Dimmable*</label>
            <select name="dimmable" id="dimmable">
              <option value="1">Yes</option>
              <option value="0">No</option>              
            </select>
            
            <label>Lumen Output</label>
            <input type="text" name="lumout" id="lumout"  placeholder="Lumen Output">
            
            <label>Efficacy</label>
            <input type="text" name="effi" id="effi"  placeholder="Efficacy">
            
            <label>Units Per Pack</label>
            <input type="text" name="upp" id="upp"  placeholder="Units Per Pack">
            
             <label>Color Rendering Index</label>
            <input type="text" name="cri" id="cri"  placeholder="Color Rendering Index">
            
            <label>Color Temperature</label>
            <input type="text" name="colorTemp" id="colorTemp"  placeholder="Color Temperature">
            
            <label>12NC 929000</label>
            <input type="text" name="nc" id="nc"  placeholder="12NC 929000">
            
                        
            <button type="submit" class="btn">Submit</button>
          </fieldset>
        </form>
       </div>
       <!-- end add-item-grp -->
       <!-- start delete-update-item-grp -->
       <div id="delete-update-item-grp" class="col_12 right">
       		 
             <div class="col_3 paginationWrap"><div class="pagination"><ul><?php 
			 	$currentpage = $_GET['view'];
  				switch($currentpage){
					case 1:
						echo '<li class="active"><a href="#">1</a></li>';
    					echo '<li><a href="adminpage.php?view=2">2</a></li>';
    					echo '<li><a href="adminpage.php?view=3">3</a></li>';
						break;
					case 2:
						echo '<li><a href="adminpage.php?view=1">1</a></li>';
    					echo '<li class="active"><a href="#">2</a></li>';
    					echo '<li><a href="adminpage.php?view=3">3</a></li>';
						break;
					case 3:
						echo '<li><a href="adminpage.php?view=1">1</a></li>';
    					echo '<li><a href="adminpage.php?view=2">2</a></li>';
    					echo '<li class="active"><a href="#">3</a></li>';
						break; 
				} 
  
			 ?></ul></div></div>
             <div class="legend">Manage Items</div>
             <div class="clearfix"></div>
             <table class="table table-striped table-hover">
             	<!-- start thead -->
             	<thead>
                	<?php
						
						$view = $_GET['view'];
						if($view == 1){
							displayItemInfo();
						}else if($view == 2){ 
							displayItemDesc1();
						}else if($view == 3){ 	
							displayItemDesc2();							
						} // end if
					?>
                </tbody>
                <!-- end tbody -->
             </table>
       </div>
       <!-- end delete-update-item-grp -->
    	<div class="clear"></div>
    </section>
    <footer class="row">

		<div class="col_16 col">all rights reserved &copy; <a href="#">LEDLAMPS</a> | </div>

	</footer>
	<?php
		//generateModals();
	?>
    <script src="js/bootstrap.min.js"></script>
</body>
</html>